<template>
  <div>生命钩子函数</div>
  <div>cesces</div>
</template>

<script>
import { defineComponent, onBeforeMount, onMounted, onBeforeUpdate, onUpdated, onBeforeUnmount, onUnmounted, onErrorCaptured, onRenderTracked, onRenderTriggered } from 'vue'
export default defineComponent({
  //beforeCreate和created是vue2的
  beforeCreate() {
    console.log('------beforeCreate-----')
  },
  created() {
    console.log('------created-----')
  },
  setup() {
    console.log('------setup-----')
    // vue3.x生命周期写在setup中
    onBeforeMount(() => {
      console.log('------onBeforeMount-----')
    })
    onMounted(() => {
      console.log('------onMounted-----')
    }) // 调试哪些数据发生了变化
    onRenderTriggered((event) => {
      console.log('------onRenderTriggered-----', event)
    })
  }
})
</script>

<style>
</style>